package com.example.tests;

public class ContactObject {
	
	public String firstName;
	public String lastName;
	public String mainAddress;
	public String telephoneHome;
	public String telephoneMobile;
	public String telephoneWork;
	public String mainEmail;
	public String alternativeEmail;
	public String birthDay;
	public String birthMonth;
	public String birthYear;
	public String chooseGroup;
	public String alternativeAddress;
	public String alternativeTelephoneHome;
	public String id;
	private String fullName = firstName + " " + lastName;;
	
	public ContactObject setFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}
	
	public ContactObject setLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}
	
	public ContactObject setMainAddress(String mainAddress) {
		this.mainAddress = mainAddress;
		return this;
	}
	
	public ContactObject setTelephoneHome(String telephoneHome) {
		this.telephoneHome = telephoneHome;
		return this;
	}
	
	public ContactObject setTelephoneMobile(String telephoneMobile) {
		this.telephoneMobile = telephoneMobile;
		return this;
	}
	
	public ContactObject setTelephoneWork(String telephoneWork) {
		this.telephoneWork = telephoneWork;
		return this;
	}
	
	public ContactObject setMainEmail(String mainEmail) {
		this.mainEmail = mainEmail;
		return this;
	}
	
	public ContactObject setAlternativeEmail(String alternativeEmail) {
		this.alternativeEmail = alternativeEmail;
		return this;
	}
	
	public ContactObject setBirthDay(String birthDay) {
		this.birthDay = birthDay;
		return this;
	}
	
	public ContactObject setBirthMonth(String birthMonth) {
		this.birthMonth = birthMonth;
		return this;
	}
	
	public ContactObject setBirthYear(String birthYear) {
		this.birthYear = birthYear;
		return this;
	}
	
	public ContactObject setChooseGroup(String chooseGroup) {
		this.chooseGroup = chooseGroup;
		return this;
	}
	
	public ContactObject setAlternativeAddress(String alternativeAddress) {
		this.alternativeAddress = alternativeAddress;
		return this;
	}
	
	public ContactObject setAlternativeTelephoneHome(String alternativeTelephoneHome) {
		this.alternativeTelephoneHome = alternativeTelephoneHome;
		return this;
	}
	
	public ContactObject setId(String id) {
		this.id = id;
		return this;
	}
	
	public ContactObject setFullName(String fullName) {
		this.fullName = fullName;
		return this;
	}

	@Override
	public String toString() {
		return "Contact [" + id + ": " + fullName + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactObject other = (ContactObject) obj;
		if (fullName == null) {
			if (other.fullName != null)
				return false;
		} else if (!fullName.equals(other.fullName))
			return false;
		if (id != null && other.id != null) {
				return id.equals(other.id);
		}
		return true;
	}
	
}